package com.luhui.consumer;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author luhui
 * @version 1.0
 * Email: luhui60@jd.com
 * date:2021/4/27 15:31
 * description：
 **/
@Component
@RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "consumer2", autoDelete = "true"),
        // 广播模式Fanout不需要路由键
        exchange = @Exchange(value = "fanout-exchange", type = ExchangeTypes.FANOUT)
))
public class MyRabbitListener {


    @RabbitHandler
    public void receiver0(String msg) {
        System.out.println("receiver2++++++++++:" + msg);
    }
}
